#include "imagebutton.h"
#include <QPainter>
#include "commondef.h"

ImageButton::ImageButton(QWidget *parent,QSizeF s,QImage normalImage,QImage pressImage) :
    BaseBtnWidget       (parent),
    m_normalImage       (normalImage),
    m_pressImage        (pressImage)
{
    m_size = s;
}

ImageButton::~ImageButton()
{
}

void ImageButton::paintEvent(QPaintEvent *)
{
    QPainter    p(this);

    switch(m_state)
    {
    case NORMAL_IB:
    {
        p.drawImage(QRectF(QPointF(0.0f,0.0f),m_size),
                    m_normalImage,
                    QRectF(QPointF(0.0f,0.0f),m_size));
    }
        break;
    case PRESS_IB:
    {
        p.drawImage(QRectF(QPointF(0.0f,0.0f),m_size),
                    m_pressImage,
                    QRectF(QPointF(0.0f,0.0f),m_size));
    }
        break;
    default:
        break;
    }
}
